home *** CD-ROM | disk | FTP | other *** search
/ International Beauties / International Beauties.iso / title.mst < prev    next >
Text File  |  1994-04-11  |  15KB  |  489 lines

  1. '**************************************************************************
  2. '*
  3. '* TITLE.MST - Runtime Setup Script
  4. '*
  5. '* CUSTOMIZING TITLE.MST
  6. '*
  7. '* For a simple Setup routine, you just need to assign values to the 
  8. '* series of variables following the heading "Setup Variables". This
  9. '* script also provides for the following more-advanced options, which
  10. '* are supported by subroutines located later in this script:
  11. '*
  12. '* Option                                         See Subroutine
  13. '* ------------------------------------------     ---------------------
  14. '* Install more than one executable file          ModifyViewerIni
  15. '* Install Help title                             ModifyViewerIni
  16. '* Install custom DLLs                            ModifyViewerIni
  17. '* Install multiple Program Manager items         ModifyProgramManager
  18. '* Display a custom icon with the ProgMan item    ModifyProgramManager
  19. '* Install custom fonts                           RegisterCustomFonts
  20. '* Install Video for Windows runtime files        RegisterDrivers
  21. '*
  22. '* Each customization note starts with the heading CUSTOMIZATION.
  23. '*
  24. '**************************************************************************
  25.     
  26.     '' Global variables
  27.  
  28.     GLOBAL TitleShortName$
  29.     GLOBAL TitleLongName$
  30.     GLOBAL EXEFileName$
  31.     GLOBAL EXEFileExtension$
  32.     GLOBAL EXEIconFile$
  33.     GLOBAL PromptForPath%
  34.     GLOBAL DefaultPath$
  35.     GLOBAL szTitleDir$
  36.     GLOBAL ProgManGroup$
  37.     GLOBAL ProgManItem$
  38.  
  39.     '' ****************************************************************
  40.     '' ** Setup Variables
  41.     '' ****************************************************************
  42.  
  43.     '' Set the following string to a short form of the title name
  44.     '' (for example, "Gallery")
  45.     
  46.     TitleShortName$ = "International Beauties"
  47.     
  48.     '' Set the following string to a long form of the title name
  49.     '' (for example, "Viewer 2.0 Gallery")
  50.     
  51.     TitleLongName$ = "International Beauties"
  52.         
  53.     '' Set the following variable to the name of the MVB file, without 
  54.     '' the filename extension (for example, "GALLERY")
  55.         
  56.     EXEFileName$ = "INTNLBTY"
  57.     EXEFileExtension$ = ".EXE"
  58.     EXEIconFile$ = "BEATYAPP.ICO"
  59.     
  60.     '' The following variable determines whether Setup prompts the user
  61.     '' to specify a directory in which to install title files. (Files
  62.     '' to be installed on the hard disk must be listed in the TITLE.INF 
  63.     '' file under the [Installed Title Files] section.) Specify one of
  64.     '' the following values:
  65.     ''
  66.     '' 0    Install title files in the Windows directory (default setting).
  67.     ''      This is an appropriate setting if you have a limited number
  68.     ''      of files to copy (for example, a single custom icon or DLL).
  69.     ''
  70.     '' 1    Display a dialog box to prompt the user for a directory in 
  71.     ''      which to install files
  72.         
  73.     PromptForPath% = 1
  74.         
  75.     '' If you have specified 1 in PromptForPath%, set the following 
  76.     '' variable to the default path that will be displayed in the dialog
  77.     '' box (for example, "C:\GALLERY").
  78.         
  79.     DefaultPath$ = "C:\BEAUTIES"
  80.     
  81.     '' Set the following variable to the name of the program manager 
  82.     '' group you would like to create (for example, "Viewer 2.0 Gallery")
  83.         
  84.     ProgManGroup$ = "Universal Beauties"
  85.     
  86.     '' Set the following variable to the caption of the program manager 
  87.     '' item for your title (for example, "Gallery")
  88.         
  89.     ProgManItem$ = "International Beauties"
  90.     
  91.     '***********************************************************************
  92.     '** Mainline
  93.     '***********************************************************************
  94.  
  95.     GLOBAL CUIDLL$
  96.  
  97.     '' Include files
  98.     '$INCLUDE 'setupapi.inc'
  99.     
  100.     '' Custom UI dll
  101.     CUIDLL$ = "mscuistf.dll"
  102.     
  103.     '' Dialog ID's
  104.     ''CONST DESTPATH      = 1000
  105.     ''CONST APPHELP       = 2000
  106.     ''CONST TOOBIG        = 3000
  107.     ''CONST BADPATH       = 4000
  108.     ''CONST SUCCESS       = 5000
  109.     CONST DESTPATH      = 300
  110.     CONST APPHELP       = 900
  111.     CONST TOOBIG        = 6300
  112.     CONST BADPATH       = 6400
  113.     CONST SUCCESS       = 700
  114.     CONST EXITQUIT        = 600
  115.     
  116.     '' Bitmap ID
  117.     CONST LOGO = 1
  118.     
  119.     '' Functions and subroutines
  120.     ''DECLARE FUNCTION AddFont LIB "mscuistf.dll" (szFont$, szName$) AS INTEGER
  121.     DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  122.     DECLARE FUNCTION GetTitleDir (szDefault$) AS STRING
  123.     DECLARE FUNCTION CopyFiles(szTitleDir$) AS INTEGER
  124.     DECLARE SUB RegisterFont(fontfile$, fontname$)
  125.     DECLARE SUB ModifyViewerIni
  126.     DECLARE SUB RegisterCustomFonts
  127.     DECLARE SUB ModifyProgramManager
  128.     DECLARE SUB ShowSuccess
  129.     DECLARE SUB RegisterDrivers
  130.     
  131.     '' The following statement turns size checking off. Set it to scmOnFatal 
  132.     '' to enable size checking, where Setup will compare the disk file size 
  133.     '' with the INF file size and report an error if they are not the same.
  134.     
  135.     i% = SetSizeCheckMode(scmOff)
  136.     
  137.     '' Set the title and banner bitmap. You must rebuild MSCUISTF.DLL to 
  138.     '' alter the banner bitmap.
  139.     
  140.     SetTitle "Universal Beauties Series"
  141.     SetBitmap CUIDLL$, LOGO 
  142.     
  143.     '' Read in the INF file.
  144.     
  145.     ReadInfFile GetSymbolValue("STF_CWDDIR") + "TITLE.INF"
  146.     
  147.     '' Decide where to put title files
  148.     IF PromptForPath% = 1 THEN
  149.         szTitleDir$ = GetTitleDir(DefaultPath$)
  150.         IF szTitleDir$ = "" THEN
  151.             GOTO BADQUIT
  152.         ENDIF
  153.     ELSE
  154.         szTitleDir$ = GetWindowsDir()
  155.     ENDIF   
  156.     
  157.     '' Copy files
  158.     IF CopyFiles(szTitleDir$) = 0 THEN
  159.         GOTO QUIT
  160.     ENDIF
  161.  
  162.     '' Register in .INI
  163.     ModifyViewerIni
  164.  
  165.     '' Register custom fonts
  166.     ''RegisterCustomFonts
  167.  
  168.     '' Register drivers
  169.     RegisterDrivers
  170.     
  171.     '' Modify Program Manager
  172.     ModifyProgramManager    
  173.     
  174.     '' Success dialog
  175.     ShowSuccess
  176.     
  177.     '' Now start the title
  178.     ''RUN szTitleDir$ + "\" + EXEFileName$ + EXEFileExtension$, NOWAIT
  179.  
  180.     GOTO QUIT
  181.  
  182. BADQUIT:
  183.  
  184.     gb$ = UIStartDlg(CUIDLL$, EXITQUIT, "FInfo0DlgProc", 0, "")
  185.  
  186. QUIT:
  187.     
  188.     END
  189.     
  190.  
  191. '*************************************************************************
  192. '** Purpose:
  193. '**     Prompts the user for a path for the title files
  194. '** Arguments:
  195. '**     szDefault$ - default path
  196. '** Returns:
  197. '**     New valid path name, or "" if the user quit.
  198. '*************************************************************************
  199.  
  200. FUNCTION GetTitleDir (szDefault$) STATIC AS STRING
  201.  
  202.     SetSymbolValue "String", TitleShortName$
  203.     SetSymbolValue "EditTextIn", szDefault$
  204.     SetSymbolValue "EditFocus", "ALL"
  205.  
  206.     GETPATH:
  207.  
  208.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, "FHelpDlgProc")
  209.  
  210.     IF sz$ = "CONTINUE" THEN
  211.         szTitleDir$ = GetSymbolValue("EditTextOut")
  212.         IF IsDirWritable(szTitleDir$) = 0 THEN
  213.  
  214.             BADPATH:
  215.  
  216.             sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfoDlgProc", 0, "")
  217.             IF sz$ = "REACTIVATE" THEN
  218.                 GOTO BADPATH
  219.             END IF
  220.             UIPop 1
  221.             GOTO GETPATH
  222.         END IF
  223.         UIPop 1
  224.         CreateDir szTitleDir$, cmoNone
  225.  
  226.     ELSEIF sz$ = "REACTIVATE" THEN
  227.         GOTO GETPATH
  228.  
  229.     ELSE
  230.         szTitleDir$ = ""
  231.  
  232.     END IF
  233.  
  234.     GetTitleDir = szTitleDir$
  235.  
  236. END FUNCTION
  237.  
  238.  
  239. '*************************************************************************
  240. '** Purpose:
  241. '**     Copies the files in the INF file
  242. '** Arguments:
  243. '**     szTitleDir$ - destination directory for the title files
  244. '** Returns
  245. '**     1 if files were copied, 0 otherwise
  246. '*************************************************************************
  247.  
  248. FUNCTION CopyFiles(szTitleDir$) STATIC AS INTEGER
  249.  
  250.     '' Add all system files to the copy list
  251.     AddSectionFilesToCopyList "System Files", GetSymbolValue("STF_SRCDIR"), GetWindowsSysDir()
  252.     
  253.     '' Add all of the title files to the copy list.
  254.     '' szTitleDir$ = (predefined path) if prompt user == TRUE
  255.     '' szTitleDir$ = (Windows system) directory otherwise.
  256.     AddSectionFilesToCopyList "Installed Title Files", GetSymbolValue("STF_SRCDIR"), szTitleDir$
  257.     
  258.     '' Check size
  259.     szExtras$ = "Extra"
  260.     szCosts$ = "Costs"
  261.     szNeededs$ = "Neededs"
  262.     FOR i% = 1 TO 26 STEP 1
  263.         AddListItem szExtras$, "0"
  264.     NEXT i%
  265.     
  266.     '' We assume that .INI will take another 4K
  267.     ReplaceListItem szExtras$, ASC(MID$(GetWindowsDir(), 1, 1)) - ASC("A") + 1, STR$(4096)
  268.     
  269.     '' Get amount of space required
  270.     StillNeed& = GetCopyListCost(szExtras$, szCosts$, szNeededs$)
  271.     
  272.     '' Put up a message if there is not enough space
  273.     FOR i% = 1 TO 26 STEP 1
  274.         IF VAL(GetListItem(szNeededs$, i%)) > 0 THEN
  275.     
  276.             SetSymbolValue "String1", LTRIM$(STR$(VAL(GetListItem(szCosts$, i%)) / 1024))
  277.             SetSymbolValue "String2", CHR$(i% - 1 + ASC("A"))
  278.     
  279.             TOOBIG:
  280.     
  281.             sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfoDlgProc", 0, "")
  282.             IF sz$ = "REACTIVATE" THEN
  283.                 GOTO TOOBIG
  284.             END IF
  285.             UIPop 1
  286.             CopyFiles = 0
  287.             GOTO DONTCOPY
  288.         END IF
  289.     NEXT i%
  290.     
  291.     '' Copy the files
  292.     CopyFilesInCopyList
  293.     
  294.     CopyFiles = 1
  295.  
  296. DONTCOPY:
  297.  
  298. END FUNCTION
  299.  
  300.  
  301. '*************************************************************************
  302. '** Purpose:
  303. '**     Puts up a success dialog
  304. '*************************************************************************
  305.  
  306. SUB ShowSuccess STATIC
  307.  
  308.     SUCCESS:
  309.     
  310.     SetSymbolValue "String1", TitleShortName$
  311.     sz$ = UIStartDlg(CUIDLL$, SUCCESS, "FInfoDlgProc", 0, "")
  312.     IF sz$ = "REACTIVATE" THEN
  313.         GOTO SUCCESS
  314.     END IF
  315.     UIPop 1
  316.     
  317. END SUB
  318.  
  319.  
  320. '*************************************************************************
  321. '** Purpose:
  322. '**     Appends a file name to the end of a directory path,
  323. '**     inserting a backslash character as needed.
  324. '** Arguments:
  325. '**     szDir$  - full directory path (with optional ending "\")
  326. '**     szFile$ - filename to append to directory
  327. '** Returns:
  328. '**     Resulting fully qualified path name.
  329. '*************************************************************************
  330.  
  331. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  332.     IF szDir$ = "" THEN
  333.         MakePath = szFile$
  334.     ELSEIF szFile$ = "" THEN
  335.         MakePath = szDir$
  336.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  337.         MakePath = szDir$ + szFile$
  338.     ELSE
  339.         MakePath = szDir$ + "\" + szFile$
  340.     END IF
  341. END FUNCTION
  342.  
  343.  
  344. '*************************************************************************
  345. '** Purpose:
  346. '**     Registers a font.
  347. '** Arguments:
  348. '**     fontfile$ - font filename
  349. '**     fontname$ - font name.
  350. '*************************************************************************
  351.  
  352. SUB RegisterFont(fontfile$, fontname$) STATIC
  353.  
  354.     '' A simple error catching wrapper around AddFont, which is a 'C' routine in MSCUISTF.DLL
  355.  
  356.     ''IF AddFont(fontfile$, fontname$) = -1 THEN
  357.     ''    j% = DoMsgBox("Could not install " + fontfile$ + " font.", "Viewer Font Installation", 0)
  358.     ''ENDIF
  359.  
  360. END SUB
  361.  
  362.  
  363. '*************************************************************************
  364. '** Purpose:
  365. '**     Registers title in INI
  366. '*************************************************************************
  367.  
  368. SUB ModifyViewerIni STATIC
  369.  
  370.     '' Get the .INI file
  371.     
  372.     szIni$ = MakePath(GetWindowsDir(), "BEAUTIES.INI")
  373.  
  374.     '' First register the title file, setting the Name and Path entries. 
  375.     '' We assume that the executable file is the same directory as SETUP.EXE.
  376.     ''
  377.     '' CUSTOMIZATION: If you're installing multiple executable files, copy the
  378.     '' following two statements for each additional file, substituting
  379.     '' the appropriate long name and executable filename for the TitleLongName$
  380.     '' and EXEFileName$ variables.
  381.     
  382.     CreateIniKeyValue szIni$, "Path", EXEFileName$+EXEFileExtension$, GetSymbolValue("STF_SRCDIR") + ", Please insert the " + TitleShortName$ + " disk or reinstall the product.", cmoOverwrite
  383.  
  384.     '' CUSTOMIZATION: If you're installing a Help title or any custom DLLs,
  385.     '' you should copy the preceding statement for each extra title or DLL.
  386.     ''
  387.     '' Example for installing an extra title:
  388.     ''
  389.     ''    CreateIniKeyValue szIni$, "FILES", "GALHELP.MVB", GetSymbolValue("STF_SRCDIR") + "," + "Please insert the Viewer 2.0 Gallery disk.", cmoOverwrite
  390.     ''
  391.     '' Example for installing a custom DLL:
  392.     ''
  393.     ''    CreateIniKeyValue szIni$, "FILES", "GALLERY.DLL", GetSymbolValue("STF_SRCDIR") + "," + "A required file is missing. Please reinstall the Viewer Gallery.", cmoOverwrite
  394.  
  395. END SUB
  396.  
  397.  
  398. '*************************************************************************
  399. '** Purpose:
  400. '**     Creates program manager entries for the title
  401. '*************************************************************************
  402.  
  403. SUB ModifyProgramManager STATIC
  404.  
  405.     '' Create the program manager group
  406.  
  407.     CreateProgmanGroup ProgmanGroup$, "", cmoNone
  408.     ShowProgmanGroup ProgmanGroup$, 1, cmoNone
  409.     
  410.     '' Create an entry for the title
  411.      
  412.     CreateProgmanItem ProgmanGroup$, ProgmanItem$, MakePath(szTitleDir$, EXEFileName$ + EXEFileExtension$), MakePath(szTitleDir$, EXEIconFile$), cmoOverwrite
  413.     
  414.     '' CUSTOMIZATION: 
  415.     ''
  416.     '' To create additional Program Manager items, copy the preceding 
  417.     '' statement for each additional item, substituting the appropriate
  418.     '' name for the EXEFileName$ variable.
  419.     ''
  420.     '' To display a custom icon with the Program Manager item, specify
  421.     '' the icon filename with the fourth parameter (this parameter is 
  422.     '' currently an empty string, ""). The following example specifies 
  423.     '' an icon with the same filename as the .MVB file:
  424.     ''
  425.     ''       CreateProgmanItem ProgmanGroup$, ProgmanItem$, "mviewer2.exe " + MakePath(GetSymbolValue("STF_SRCDIR"), EXEFileName$ + ".MVB"), MakePath(GetSymbolValue("STF_SRCDIR"), EXEFileName$ + ".ICO"), cmoOverwrite
  426.  
  427. END SUB
  428.  
  429.  
  430. '*************************************************************************
  431. '** Purpose:
  432. '**     Registers custom fonts with Windows.
  433. '*************************************************************************
  434.  
  435. SUB RegisterCustomFonts STATIC
  436.  
  437.     '' CUSTOMIZATION: If you install custom fonts, then add statements
  438.     '' in this routine to register the fonts with the current Windows 
  439.     '' session and to add them to the WIN.INI [Fonts] section. 
  440.     ''
  441.     '' Note that TrueType fonts can only be installed in Windows 3.1.
  442.     '' RegisterFont automatically creates the required .FOT file for 
  443.     '' TrueType fonts.
  444.     ''    
  445.     '' The following example registers a font residing in MISTRAL.TTF
  446.     '' and installs the font with the name Mistral (True Type):
  447.     '' 
  448.     ''     RegisterFont "mistral.ttf", "Mistral (TrueType)"
  449.     ''
  450.  
  451. END SUB
  452.  
  453.  
  454. '*************************************************************************
  455. '** Purpose:
  456. '**     Registers Windows drivers
  457. '*************************************************************************
  458.  
  459. SUB RegisterDrivers STATIC
  460.  
  461. '' CUSTOMIZATION: Video for Windows is not a standard component of
  462. '' Windows 3.1. If your title uses video, proceed as follows.
  463. ''
  464. '' 1) Add the following files to the [System Files] section of the INF file:
  465. ''
  466. ''    dispdib.dll
  467. ''    msvideo.dll
  468. ''    indeo.drv
  469. ''    mciavi.drv
  470. ''    msvidc.drv
  471. ''
  472. '' 2) Add the above files to your release directory. US versions can be 
  473. ''    found in the \SYSTEM subdirectory of your Viewer disc. French and
  474. ''    German versions were not available at ship time. Please contact 
  475. ''    Microsoft or check the Multimedia Viewer section on the Microsoft
  476. ''    Compuserve Forum for further details.
  477. ''
  478. '' 3) Uncomment the following lines:
  479. ''
  480. '' CreateIniKeyValue "WIN.INI", "mci extensions", "AVI", "AVIVIDEO", cmoNone
  481. '' CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "mci", "AVIVIDEO", "MCIAVI.DRV", cmoNone
  482. '' CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "drivers", "vidc.msvc", "msvidc.drv", cmoNone
  483. '' CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "drivers", "vidc.rt21", "indeo.drv", cmoNone
  484.  
  485. END SUB
  486.  
  487.  
  488.  
  489.